<?php
declare(strict_types=1);
namespace App\Service\Users;
use App\Models\Users\UserAddress;
class UserAddressesSave implements UserAddressesSaveInterface{
    public function store($request):bool{
        $request->user()->addresses()->create($request->only([
            'province',
            'city',
            'district',
            'address',
            'zip',
            'contact_name',
            'contact_phone',
        ]));
        return true;
    }
    public function update($request,$user_address):bool{
        $user_address->update($request->only([
            'province',
            'city',
            'district',
            'address',
            'zip',
            'contact_name',
            'contact_phone',
        ]));
        return true;
    }

    public function destroy($user_address):bool{
        $user_address->update(
            ['status'=>UserAddress::StatusFalse]
        );
        return true;
    }
}
